from ronglian_sms_sdk import SmsSDK

# 容联云通讯分配的主账号ID
accId = '8aaf070874af41ee01751a86c67121c3'
# 主账号Token
accToken = '8cfaafe843e1420f93c210f228d7bf07'
# 应用id
appId = '8aaf070874af41ee01751a86c74a21c9'


def send_message(params):
    """
    :param params: 请求参数
    params = {
        "tid":"1",
        "mobile":"xxx",
        "code":"",
        "time":"",
    }
    :return:
    """
    sdk = SmsSDK(accId, accToken, appId)
    # 容联云通讯创建的模板ID
    tid = params.get("tid")
    # 手机号1,手机号2
    mobile = params.get("mobile")
    # '变量1', '变量2'
    datas = (params.get("code"), params.get("time"))
    resp = sdk.sendMessage(tid, mobile, datas)
    print(resp)


if __name__ == '__main__':
    params = {
        "tid": "1",
        "mobile": "xxx",
        "code": "",
        "time": "",
    }
    send_message(params)
